import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

import java.sql.SQLOutput;
import java.util.Scanner;
public class FacNumber {
    //用方法求阶乘1

    //求数字阶乘的和
    public static int facNum(int num){
        int sum = 0;
        for (int j = 1; j <= num; j++) {
            int ret = fac(j);//专门求数字j的阶乘，这样写使我们的程序看着比较简洁清晰
            sum += ret;
        }
        return sum;
    }
    //求数字阶乘
    public static int fac(int n){
        int ret = 1;
        for (int i = 1; i <= n; i++) {
            ret *= i;
        }
        return ret;
    }
    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int fir = facNum(n);
        System.out.println(fir);
    }





    public static void main1(String[] args) {
        //求1到n的阶乘的和
        int sum = 0;
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        for (int j = 1; j <= n; j++) {
            int ret = 1;
            for (int i = 1; i <= j; i++) {
                ret *= i;
            }
            sum += ret;
        }
        System.out.println(sum);
    }

}
